'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {

  const { router, controller } = app;

  // router.get('/', controller.page.index);

  router.get('/api/', controller.home.index);
  
  router.post('/api/auth/login', controller.auth.login)
  router.post('/api/auth/logout', controller.auth.logout)
  router.put('/api/auth/password', controller.auth.updatePassword)
  router.get('/api/auth/userinfo', controller.auth.userinfo)

  //公司
  router.put('/api/company/update', controller.company.update)

  router.post('/api/auth/upload', controller.upload.uploadOne)
  

  //设备列表
  router.resources('devices', '/api/devices', controller.devices);

  router.post('/api/data/real/:pdi', controller.data.index)

  router.get('/api/data/device/:typeid', controller.data.devicesByType)

  router.post('/api/data/typedevice/:typeid', controller.data.devicesRealData)

  router.get('/api/data/devicetypes', controller.data.devicetype)


  //告警
  router.get('/api/alarm/real', controller.alarmReal.index)
  router.get('/api/alarm/history', controller.alarmHistory.index)

};
